{template 'header'}
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
            <a href="">日志中心</a>
        <a>
          <cite>任务完成日志</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" id="search">
            <input class="layui-input" autocomplete="off" placeholder="开始日" name="start_time" id="start_time"
                   value="{$_GPC['start_time']}">
            <input class="layui-input" autocomplete="off" placeholder="截止日" name="end_time" id="end_time"
                   value="{$_GPC['end_time']}">
            <input type="text" name="keyword" placeholder="用户ID/手机号/任务ID" autocomplete="off" class="layui-input" id="keyword"
                   value="{$keyword}">
            <div class="layui-input-inline">
                <select name="logtype">
                    <option value="" {if $logtype==''}selected{/if}>请选择日志类型</option>
                    <!--<option value="-1" {if $logtype=='-1'}selected{/if}>任务失效</option>-->
                    <option value="1" {if $logtype=='1'}selected{/if}>接受任务</option>
                    <option value="2" {if $logtype=='2'}selected{/if}>提交任务</option>
                    <option value="3" {if $logtype=='3'}selected{/if}>通过审核</option>
                    <option value="4" {if $logtype=='4'}selected{/if}>驳回任务</option>
                </select>
            </div>
            <button class="layui-btn" lay-submit="" lay-filter="search"><i class="layui-icon">&#xe615;</i></button>
        </form>
    </div>
    <xblock>
        <button class="layui-btn layui-btn-radius" onclick="exportUser()"><i class="layui-icon"></i>导出Excel</button>
        <span class="x-right" style="line-height:40px">共有数据：{$total} 条</span>
    </xblock>
    <table class="layui-table x-admin">
        <thead>
        <tr>
            <th>
                <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i
                        class="layui-icon">&#xe605;</i></div>
            </th>
            <th>日志ID</th>
            <th>日志类型</th>
            <th>接受任务ID</th>
            <th>用户信息</th>
            <th>任务信息</th>
            <th>任务金额</th>
            <th>备注</th>
            <th>创建时间</th>
        </tr>
        </thead>
        <tbody>
        {if $total==0}

        <tr>
            <td colspan="11" style="text-align: center;">暂无数据</td>
        </tr>

        {else}
        {loop $list $item}
        <tr>
            <td>
                <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='{$item["id"]}'><i
                        class="layui-icon">&#xe605;</i></div>
            </td>
            <td>{$item["id"]}</td>
            <td>
                {if $item['type'] == '-1'}
                <span style="color: red">任务失效(过期或被删除)</span>
                {elseif $item['type'] == '1'}
                <span style="color: red">接受任务</span>
                {elseif $item['type'] == '2'}
                <span style="color: red">提交任务</span>
                {elseif $item['type'] == '3'}
                <span style="color: red">通过审核</span>
                {elseif $item['type'] == '4'}
                <span style="color: red">驳回任务</span>
                {/if}
            </td>
            <td>{$item["receive_id"]}</td>
            <td>用户ID:{$item["user_id"]}<br>手机号:{$item["mobile"]}</td>
            <td>任务ID:{$item["taskid"]}<br>任务标题:{$item["task_title"]}</td>
            <td>{$item["task_money"]}</td>
            <td>{$item["remark"]}</td>
            <td>{php echo date('Y-m-d H:i:s',$item["create_time"])}</td>
        </tr>
        {/loop}
        {/if}
        </tbody>
    </table>
    <div class="page">
        {$pager}
    </div>
</div>
</body>
<script>
    layui.use('form', function () {
        var form = layui.form;

        //监听提交
        form.on('submit(search)', function (data) {
            console.log(data.field)
            var str = '';
            for (var key in data.field) {
                str += key + "=" + data.field[key] + "&";
            }
            var url = '{php echo $this->createWebUrl("user_task_log")}'
            location.href = url + "&" + str;
            return false;
        });
    });

    function exportUser(){
        var str = $('#search').serialize()
        var ids = tableCheck.getData();
        var url = '{php echo $this->createWebUrl("")}'
        location.href = url + "&" + str + "&ids=" + ids;
    }

    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start_time', //指定元素
            type: 'datetime'
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end_time', //指定元素
            type: 'datetime'
        });
    });

</script>
<script>var _hmt = _hmt || [];
(function () {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>
</html>